home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / MSG Graphic Effects 1.0 Source / Full scroll U-D.c < prev    next >
Text File  |  1993-08-23  |  2KB  |  53 lines

  1. /*******************************************************************************
  2.  * Copyright © 1992-1993 Mark Pilgrim                                          *
  3.  *                                                                             *
  4.  * This file is provided as is, and may be freely distributed unaltered.  This *
  5.  * message must accompany any copy of this file.  This file may be used or     *
  6.  * modified for use for a non-commercial product provided that appropriate     *
  7.  * credit is given to the author named above.                                  *
  8.  * Commercial use of this source code is prohibited.                           *
  9.  ******************************************************************************/
  10.  
  11. #include "msg misc.h"
  12. #include "msg timing.h"
  13.  
  14. #define        BoxSize        10
  15. #define CorrectTime 3
  16.  
  17. void FullScrollUD(GrafPtr);
  18.  
  19. /* Take the full screen minus the bottom strip, move it into the whole screen
  20.    shifted down by BoxSize, then take the bottommost source strip and put it
  21.    in the top strip of the dest. window. */
  22.    
  23. void FullScrollUD(GrafPtr sourceGrafPtr)
  24. {
  25.     int            x, y;
  26.     Rect        theRect, dest;
  27.     Rect        scrollsource, scrolldest;
  28.     
  29.     scrollsource=gMainWindow->portRect;
  30.     scrollsource.bottom-=BoxSize;              /* whole screen minus bottom strip */
  31.     scrolldest = scrollsource;
  32.     OffsetRect(&scrolldest, 0, BoxSize);       /* whole screen shifted down BoxSize */
  33.     
  34.     dest = gMainWindow->portRect;
  35.     dest.bottom=BoxSize;                       /* top strip for new data */
  36.     
  37.     theRect.top=MAIN_WINDOW_HEIGHT-BoxSize;    /* bottom strip of source window */
  38.     theRect.bottom=MAIN_WINDOW_HEIGHT;
  39.     theRect.left=0;
  40.     theRect.right=MAIN_WINDOW_WIDTH;
  41.     
  42.     for(x = MAIN_WINDOW_HEIGHT - BoxSize; x >= 0; x -= BoxSize)
  43.     {
  44.         StartTiming();
  45.         CopyBits(&(gMainWindow->portBits), &(gMainWindow->portBits),
  46.                 &scrollsource, &scrolldest, 0, 0L);
  47.         CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
  48.                 &theRect, &dest, 0, 0L);
  49.         theRect.bottom-=BoxSize;
  50.         theRect.top-=BoxSize;
  51.         TimeCorrection(CorrectTime);
  52.     }
  53. }